<template>
  <load-box></load-box>
  <right-menu></right-menu>
  <console-main></console-main>
  <nav-music></nav-music>
  <right-side></right-side>
  <sidebar></sidebar>
  <router-view></router-view>
</template>

<script setup>
import theme from './utils/theme/index.js';
import tool from './utils/tool/index.js';

import loadBox from './components/loadBox/index.vue';
import rightMenu from './components/rightMenu/index.vue';
import navMusic from './components/navMusic/index.vue';
import rightSide from "./components/rightSide/index.vue";
import consoleMain from "./components/console/index.vue";
import sidebar from "./layout/sidebar/index.vue";
import {onMounted, watch} from 'vue';
import {useRoute} from 'vue-router';

const route = useRoute();
watch(() => route.fullPath, (newHash, oldHash) => {
  // 监控 Hash 记录是否是在首页
  newHash = newHash ? newHash : ''
  oldHash = oldHash ? oldHash : ''
  tool.switchIndexPage(newHash)
  tool.switchArticlePage(newHash)
  // 你可以在这里根据hash值进行相应的操作
}, {immediate: true});

onMounted(() => {
  // 禁止图片拖拽
  document.querySelectorAll("img").forEach(function (img) {
    img.addEventListener("dragstart", function (event) {
      event.preventDefault();
    });
  });
  setInterval(() => {
    theme.hideLoadBox();
  }, 1000)
});
</script>

<style scoped>
</style>